package com.gmj.controller;


import com.gmj.entity.Class;
import com.gmj.entity.Teacher;
import com.gmj.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmj
 * @since 2022-01-29
 */
@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private ITeacherService ts;
    @GetMapping("/selectAll")
    public List<Teacher> selectAll(){
        return ts.list();
    }
    @PostMapping("/add")
    public void add(@RequestBody Teacher teacher){
        ts.save(teacher);
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        ts.removeById(id);
    }
}

